
$(function () {
  goodsList();
  function goodsList () {
    searchAllGoods().then(data => {
      // console.log(data);

      var { status, list } = data;

      var html = "";
      list.forEach(function (item) {
        // console.log(item);
        var { id, title, simg, price, head1img, colorimg, goodsprice, bigimg, smalling } = item;

        html += `<li class="goods-item">
                   <a href="../html/details.html">
                    <div class="goods-body">
                      <a class="goods-pic" href="../html/details.html?gid=${id}"><img src="${bigimg}" alt=""></a>
                      <a class="goods-name ellipsis" href="../html/details.html?gid=${id}">${title}</a>
                      <div class="goods-thumbs">
                        <ul class="thumbs-list">
                          <li>
                            <a href=""><img src="${head1img}" alt=""></a>
                          </li>
                          <li>
                            <a href=""><img src="${colorimg}" alt=""></a>
                          </li>
                        </ul>
                      </div>
                      <div class="goods-price"><span>${price}</span></div>
                    </div>
                    </a>
                  </li>`
      });
      $(".goods-list").html(html);
    })
  }
  // 声明全局变量  =>赋予默认值
  var key = "";    // "" 默认查询所有数据
  var orderCol = "price";   // 默认按照price排
  var orderType = "asc"; //默认升序
  var pageIndex = 1; // 默认显示第一页  => 记录切换后的页码
  var showNum = 5;  //每页显示多少条

  $(".dropdown-btn").click(function () {
    $(".dropdown-menu").css()


  });
  console.log($(".filter-order"));

  $(".orderCol").click(function () {
    console.log(111);
    orderCol = $(this).val;
    goodsList();

  })

  $(".orderType").click(function () {
    console.log(111);
  })
})

